package ihm;

import javax.swing.JFrame;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JTextField;
import javax.swing.JSpinner;
import javax.swing.JComboBox;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class FrmAjouterTache extends JFrame{
	public FrmAjouterTache() {
		
		JLabel lblAjouterTache = new JLabel("AJOUTER TACHE");
		
		JLabel lblLibelle = new JLabel("Libelle :");
		
		JLabel lblChargePrvisionelleJourhomme = new JLabel("Charge prévisionelle");
		
		JLabel lblJourhomme = new JLabel("jour/homme :");
		
		JLabel lblMatriculeCollaborateur = new JLabel("Matricule collaborateur :");
		
		JLabel lblRfrenceContrat = new JLabel("Référence contrat :");
		
		txtLibelleAjouter = new JTextField();
		txtLibelleAjouter.setColumns(10);
		
		JSpinner spnChargeAjouter = new JSpinner();
		
		JComboBox cmbMatriculeAjouter = new JComboBox();
		
		JComboBox cmbReferenceAjouter = new JComboBox();
		
		JButton btnAjouter = new JButton("Ajouter");
		
		JButton btnQuitter = new JButton("Annuler");
		btnQuitter.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				dispose();
			}
		});
		GroupLayout groupLayout = new GroupLayout(getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addContainerGap()
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
									.addComponent(lblMatriculeCollaborateur)
									.addComponent(lblJourhomme)
									.addComponent(lblChargePrvisionelleJourhomme)
									.addComponent(lblLibelle)
									.addComponent(lblRfrenceContrat))
								.addComponent(btnAjouter))
							.addGap(18)
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false)
									.addComponent(cmbMatriculeAjouter, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
									.addComponent(txtLibelleAjouter)
									.addComponent(spnChargeAjouter, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
								.addComponent(cmbReferenceAjouter, GroupLayout.PREFERRED_SIZE, 86, GroupLayout.PREFERRED_SIZE)
								.addComponent(btnQuitter, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(104)
							.addComponent(lblAjouterTache)))
					.addContainerGap(193, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblAjouterTache)
					.addGap(69)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblLibelle)
						.addComponent(txtLibelleAjouter, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addComponent(lblChargePrvisionelleJourhomme)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblJourhomme)
						.addComponent(spnChargeAjouter, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblMatriculeCollaborateur)
						.addComponent(cmbMatriculeAjouter, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblRfrenceContrat)
						.addComponent(cmbReferenceAjouter, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(btnAjouter)
						.addComponent(btnQuitter))
					.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
		);
		getContentPane().setLayout(groupLayout);
	}
	
	private JFrame ajoutertache;
	private JTextField txtLibelleAjouter;
}
